package cn.controlsys.common.mq;



import cn.controlsys.utils.SerializeUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;


/**
 * Author: yzc <br/>
 * Description: <br/>
 * Date： 18:59 2018/2/7.<br/>
 * Modified By: <br/>
 */
@Component
public class RabbitMQConsumer {
    Logger logger = LoggerFactory.getLogger(RabbitMQConsumer.class);
//    @Autowired
//    InstructionRecordMapper instructionRecordMapper;
//    @Autowired
//    ApportionmentCalculateService apportionmentCalculateService;
//    @Autowired
//    DeviceService deviceService;

    @RabbitListener(queues = MQConstants.SAIHEYI_OPERATION_QUEUE)
    public void receiveMessage(@Payload byte[] object) {
        try {
            JSONObject obj  = JSON.parseObject(String.valueOf(SerializeUtil.ByteToObject(object)));

        } catch (Exception e) {
            logger.error("[InstructionRecord]消息处理异常！", e);
        }
    }


}
